﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using dreamwork.mobile.app.api.Models.Data;
using Microsoft.EntityFrameworkCore;

namespace dreamwork.mobile.app.api.Infrastructure
{
    public class MobileAppDbContext:DbContext
    {
        public MobileAppDbContext()
        { }

        public MobileAppDbContext(DbContextOptions<MobileAppDbContext> options)
            : base(options)
        { }

        public DbSet<NormalUser> NormalUsers { get; set; }
        public DbSet<TerminalUser> TerminalUsers { get; set; }

        protected override void OnModelCreating(ModelBuilder builder)
        {
            base.OnModelCreating(builder);

            var normalUserBuilder = builder.Entity<NormalUser>();
            normalUserBuilder.HasKey(x => x.Id);

            var terminalUserBuilder = builder.Entity<TerminalUser>();
            terminalUserBuilder.HasKey(x => x.Id);
        }
    }
}
